home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / Amos / SupraProcs / Stencil.AMOS / Stencil.amosSourceCode
Encoding:
AMOS Source Code  |  1996-01-26  |  2.0 KB  |  61 lines

  1. '   AMOSPRO
  2. '
  3. '   *******************************************************  
  4. '   ***                                                  *** 
  5. '   ***                 Stencil Procedure                *** 
  6. '   ***                                                  *** 
  7. '   ***                        by                        *** 
  8. '   ***                                                  *** 
  9. '   ***                   Joseph Bolin                   *** 
  10. '   ***                                                  *** 
  11. '   ******************************************************** 
  12.  
  13. Dim STENCIL(64)
  14. Screen Open 0,320,200,8,Lowres
  15. STENCIL(2)=1
  16. STENCIL(1)=0
  17. STENCIL(0)=1
  18. Ink 2 : Bar 0,0 To 63,63 : Ink 0 : Bar 64,64 To 128,128
  19. _STENCIL[0,1]
  20. Flash Off 
  21. For C=0 To 7
  22.    Cls C : Paste Bob 0,0,1 : Wait 60
  23. Next 
  24.  
  25. Procedure _STENCIL[_SOURCE,_DESTBOB]
  26.  
  27.    '  Inputs:  _SOURCE    Screen to stencil 
  28.    '           _DESTBOB   Bob to make into stencil    
  29.    '           STENCIL()  Colors to stencil:0=No,1=Yes    
  30.    '
  31.    '  Outputs: Makes a bob from the source screen with the unstenciled colors 
  32.    '              masked out
  33.  
  34.    Shared STENCIL()
  35.    For DEST=0 To 7
  36.       Trap Screen DEST : If Errtrap>0 Then Exit 
  37.    Next 
  38.    If DEST>7 Then Error 47
  39.    Screen _SOURCE
  40.    Screen Open DEST,Screen Width,Screen Height,Screen Colour,Screen Mode
  41.    Screen Hide DEST : Screen Copy _SOURCE To DEST : Screen DEST
  42.    For BNK=10 To 65535
  43.       If Length(B)=0 Then Exit 
  44.    Next 
  45.    Reserve As Work BNK,64
  46.    For C=0 To Screen Colour-1
  47.       If STENCIL(C)=1 Then Poke Start(BNK)+C,1 Else Poke Start(BNK)+C,0
  48.    Next 
  49.    WASHML[Screen Base,Start(BNK),0,7,Screen Width,Screen Height]
  50.    Get Bob _DESTBOB,0,0 To Screen Width,Screen Height : Paste Bob 0,0,_DESTBOB
  51.    Screen Close DEST
  52.    SBASE=Sprite Base(_DESTBOB) : Screen _SOURCE
  53.    SIZE=Deek(SBASE)*2*Deek(SBASE+2)
  54.    For P=0 To Deek(SBASE+4)-1
  55.       SB=SBASE+8+SIZE*P : SP=Leek(Screen Base+P*4)
  56.       Copy SP,SP+SIZE To SB+2
  57.    Next 
  58. End Proc
  59. Procedure WASHML[H,W,B,O,BB,SB]
  60.    ' COMPILED PROCEDURE -- can't convert this to AMOS code
  61. End Proc